<#include "../../common/commonattribute.html"/>
<script type="text/javascript" src="${ctx}/static/tag/js/tag.js"></script>
<link rel="stylesheet" type="text/css" href="${ctx}/static/tag/css/tag.css" />
<script>
$(document).on('bjui.beforeCloseDialog', function(e) {
        $(".search-article").click();
    })
$(".model").each(function(ii,vv){
    var model=$(vv).attr("model");
    $.ajax({
        type: "POST",
        url:"${ctx}/common/getModelJson?model="+model,
        async: true,
        success: function(data){

            var jsonObj = data.code;//转换为json对象
            var html="";
            if(jsonObj){
                for(var i=0;i<jsonObj.length;i++){
                    html+="<option value="+jsonObj[i].codeItem+">"+jsonObj[i].codeItemName+"</option>";
                }
                $(vv).append(html);
                $(vv).selectpicker('refresh')
                $(vv).selectpicker('render');
            }
        }
    });
});
function pic_upload_success(file, data) {
    var json = $.parseJSON(data)
    $(this).bjuiajax('ajaxDone', json)
    if (json[BJUI.keys.statusCode] == BJUI.statusCode.ok) {
        $('#j_custom_pic').val(json.filename).trigger('validate')
        $('#j_custom_span_pic').html('<img src="'+ json.filename +'" width="100" />')
    }
}
</script>
<!-- 注意， 只需要引用 JS，无需引用任何 CSS ！！！-->

<script type="text/javascript">

 /*       var E = window.wangEditor
        var editor = new E('#editor')
        // 或者 var editor = new E( document.getElementById('editor') )
        editor.create()*/

 var tag1 = new Tag("tagValue1");
tag1.tagValue = $("#tageHidden").val()   ;
 tag1.initView();

</script>
<style>
    fieldset {
        padding: .35em .625em .75em;
        margin: 0 2px;
        border: 1px solid silver;
    }

    legend {
        padding: .5em;
        border: 0;
        width: auto;
    }
</style>
<div class="bjui-pageContent">

    <form action="${ctx}/bizlogic/article/save" id="j_form_form" data-no-check="true"
          data-toggle="validate" data-alertmsg="true"  data-isrefsh="false" >

        <div style="margin:25px auto 0; width:1200px">
            <fieldset>
                <legend>发布文章</legend>
<input type="hidden" id="tageHidden" value="${tages!}">
            <table width="100%"  class="table table-condensed table-hover">
                <input type="hidden" name="id" value="${entity.id!}"/>
             <tr>
                    <td class="right"><span style="color:red">*</span>标题</td>
                    <td class="left">
                        <input type="text" name="title" data-rule="required" value="${entity.title!}" size="70">
                       </td>
                </tr>

                               <tr>
                                   <td class="right"><span style="color:red">*</span>作者</td>
                                   <td class="left"><input type="text" name="author" data-rule="required" value="${entity.author!}" ></td>
                               </tr>

                 <tr>
               <td class="right"><span style="color:red">*</span>发布时间</td>
               <td class="left"><input type="text" name="pubDate" data-rule="required" readonly  data-toggle="datepicker" data-pattern="yyyy-MM-dd HH:mm:ss" value="${((entity.pubDate)?string('yyyy-MM-dd HH:mm:ss'))!}" /></td>
           </tr>

                <tr>
                    <td class="right">是否置顶</td>
                    <td class="left"><div class="row-input required">
                        <input type="radio" name="isZd" id="j_custom_sex1" data-toggle="icheck" value="true" data-rule="checked" <#if (entity.isZd??)&&(entity.isZd)=="true"> checked</#if> data-label="是  ">
                        <input type="radio" name="isZd" id="j_custom_sex2" data-toggle="icheck" value="false" <#if (entity.isZd??)&&(entity.isZd)=="false"> checked</#if> data-label="否">
                    </div></td>

                </tr>
                 <tr>
                     <td class="right"><span style="color:red">*</span>发布状态</td>
                     <td class="left">
                         <select   data-toggle="selectpicker" data-rule="required"
                                   name="isPub" data-rule="required" class="selectpicker model" value="${entity.isPub!}" data-width="100" model="FBZT"/>
                     </td>
                 </tr>
                <tr>
                    <td class="right"><span style="color:red">*</span>封面上传</td>
                    <td><span id="j_custom_span_pic"><#if (entity.imgSrc)??><img width="100px" height="60px" src="${entity.imgSrc}"/></#if></span></td>
                    <td class="left"><div style="display: inline-block; vertical-align: middle;">
                        <div id="j_custom_pic_up" data-toggle="upload" data-uploader="${ctx}/upload?sessionid=?"
                             data-file-size-limit="1024000000"
                             data-file-type-exts="*.jpg;*.png;*.gif;*.mpg"
                             data-multi="true"
                             data-on-upload-success="pic_upload_success"
                             data-icon="cloud-upload"></div>
                        <input type="hidden" name="imgSrc" value="${entity.imgSrc!}" id="j_custom_pic">

                    </div></td>

                </tr>
                    <tr>
                        <td class="right"><span style="color:red">*</span>摘要</td>
                        <td class="left">
                            <textarea name="summary" data-rule="required" rows="3" cols="70" placeholder="请输入摘要">${entity.summary!}</textarea>
                    </tr>
                <tr>
                    <td class="right"><span style="color:red">*</span>内容</td>
                    <td>
                        <textarea name="content" id="j_form_content" class="j-content" style="width: 100%;height: 530px;resize:none"  data-toggle="kindeditor" data-minheight="200" >
                            ${(entity.content)!}
                        </textarea>
                    </td>
                </tr>
                <tr>
                    <td class="right">标签</td>
                    <td><input type="text" id="tagValue1" name="tags"></td>
                </tr>



            </table>
</fieldset>
        </div>

    </form>

</div>

<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close">关闭</button></li>
        <li><button type="submit" class="btn-default">保存</button></li>
    </ul>
</div>